package com.guli.gulimall.product.web.controller;

import com.guli.gulimall.product.entity.CategoryEntity;
import com.guli.gulimall.product.service.CategoryService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Controller;
import org.springframework.ui.Model;
import org.springframework.web.bind.annotation.RequestMapping;

import java.util.List;

@Controller
public class IndexController {
    @Autowired
    CategoryService categoryService;

    @RequestMapping(value = {"/","/index"})
    public String index(Model model){
        //访问列表时 查询所有的一级分类
        List<CategoryEntity> list=categoryService.findLevelList();
        model.addAttribute("list",list);
        return "index";
    }
}
